home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-02 | 1.8 KB | 96 lines | [TEXT/MSET] |
- \ Class PopupMenu. This version handles pop-up menus in dialogs.
- \ If we ever need one somewhere else, we'll have to define a subclass
- \ with different HIT: and NORMAL: methods.
-
- need dialog+
-
- forward DRAWBOX
-
- :proc PUboxProc
- i->l drawbox ;proc
-
- from PopUpMenuMod import{ POPUPMENU }
-
- compile: PopUpMenuMod
-
- objPtr THEMENU class_is PopUpMenu
-
- : FIND-MENU { link item# -- b }
- BEGIN
- link nilP = IF false exit then
- link -> theMenu
- box#: theMenu item# = IF true EXIT THEN
- F-link: theMenu -> link
- AGAIN ;
-
- :f DRAWBOX { dlg-hdl item# -- }
- \ Called from the PROC that handles the user item
- \ for a pop-up box.
- \ item# is is the DIALOG item#, not the menu item#.
- dlg-hdl find-dlg 0EXIT
- PUM-link: this_dlg item# find-menu 0exit
- drawbox: theMenu ;f
-
- \ endload
-
- \ TESTING:
-
- \ ========= Pop-up Menus ===========
-
- 2 PopUpMenu PU1
- 3 PopUpMenu PU2
- 3 PopUpMenu PU3
-
-
- : MMM ." menu hit" cr ;
- : NNN ." another menu hit!!" cr ;
-
- CFAS( mmm mmm ) 1 5 7 init: PU1
- CFAS( mmm mmm mmm ) 2 6 8 init: PU2
- CFAS( nnn nnn nnn ) 3 4 5 init: PU3
-
- : HPU1 hit: pu1 ;
- : HPU2 hit: pu2 ;
- : HPU3 cr ." pu3 hit!!" hit: pu3 ;
-
-
- \ ========= Dialog boxes =========
-
- 6 dialog+ D1
- 4 dialog+ D2
-
- : QQQ 20 beep ;
- : WWW 1 beep ;
- : ZZZ ." useritem hit" cr ;
-
-
- : CLOSE1 close: d1 ;
- : CLOSE2 close: d2 ;
-
- CFAS( qqq www close1 togitem hpu1 hpu2 ) 300 init: d1
- CFAS( qqq www close2 hpu3 ) 301 init: d2
-
-
- : GO
- " PMtest.rsrc" openresfile
-
- \ Set up dialogs:
-
- +modeless
- getnew: d1 getnew: d2
-
- \ Set up pop-up menus:
-
- getnew: pu1 getnew: pu2 getnew: pu3
-
- \ This part has to be done after GetNew: on the dialog(s)
-
- d1 link: pu1
- d1 link: pu2
- d2 link: pu3 ;
-
-
- : zz
- close: d1 close: d2 -modeless
- clear: menubar draw: menubar ;
-